package com.huai.demo_test1.testSolution;

class Solution2 {
    public static int climbStairs(int n) {
        long startTime = System.nanoTime();
        if(n<=1){
            return 1;
        }

        int[] c=new int[n+1];
        c[1]=1;
        c[2]=2;
        for (int i = 3; i <= n; i++) {
            c[i]=c[i-1]+c[i-2];
        }
        long endTime = System.nanoTime();
        System.out.println("运行时间"+(endTime-startTime));
        return c[n];
    }

    public static void main(String[] args) {
        int n=100000;
        System.out.println(climbStairs(n));
    }
}